﻿<UserControl x:Class="Ewav.EpiCurve"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:GadgetSelector="clr-namespace:Ewav.ContextMenu;assembly=Ewav.ContextMenu.Menu"
	xmlns:Common="clr-namespace:CommonLibrary;assembly=CommonLibrary"
	mc:Ignorable="d"
	d:DesignHeight="500" d:DesignWidth="900"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
	xmlns:my="clr-namespace:ComponentArt.Silverlight.DataVisualization.Charting;assembly=ComponentArt.Silverlight.DataVisualization.Charting" 
	xmlns:my1="clr-namespace:ComponentArt.Silverlight.DataVisualization.Utils;assembly=ComponentArt.Silverlight.DataVisualization.Common"
	xmlns:dvCharting="clr-namespace:ComponentArt.Silverlight.DataVisualization.Charting;assembly=ComponentArt.Silverlight.DataVisualization.Charting"
	xmlns:dvCommon="clr-namespace:ComponentArt.Silverlight.DataVisualization.Common;assembly=ComponentArt.Silverlight.DataVisualization.Common"
	DataContext="{Binding Source={StaticResource Locator}, Path=EpiCurveViewModel}" >
	 
	<UserControl.Resources>
		<my1:DetachFromVisualTree x:Key="ComponentArt_DashboardPanel_DetachFromVisualTree"/>
		<Style x:Key="DashboardPanelStyle1" TargetType="dvCommon:DashboardPanel">
			<Setter Property="Margin" Value="2"/>
			<Setter Property="HorizontalAlignment" Value="Stretch"/>
			<Setter Property="VerticalAlignment" Value="Stretch"/>
			<Setter Property="FontFamily" Value="Lucida Sans Unicode"/> 
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="dvCommon:DashboardPanel">
						<Grid x:Name="LayoutRoot" DataContext="{x:Null}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="ContentLoadStates">
									<VisualState x:Name="ContentLoaded">
										<Storyboard>
											<DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Cover">
												<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Collapsed"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="ContentNotLoaded">
										<Storyboard>
											<DoubleAnimation BeginTime="00:00:00" Duration="00:00:00.2" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Cover">
												<DiscreteObjectKeyFrame KeyTime="00:00:00.2" Value="Visible"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Border BorderThickness="0" CornerRadius="4">
								<Grid>
									<Grid.RowDefinitions>
										<RowDefinition Height="Auto"/>
										<RowDefinition Height="*"/>
									</Grid.RowDefinitions>
									<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{Binding}" HorizontalAlignment="Stretch" Height="23" Margin="8,3" Grid.Row="0" Visibility="{TemplateBinding HeaderVisibility}" VerticalAlignment="Stretch" OpacityMask="Black"/>
									<Grid Grid.Row="1">
										<Border CornerRadius="0,0,4,4" d:IsHidden="True"/>
										<ContentPresenter x:Name="Content" HorizontalAlignment="Stretch" Margin="2,2" Opacity="0" VerticalAlignment="Stretch"></ContentPresenter>
										<Grid x:Name="Cover" Background="Transparent" IsHitTestVisible="True" d:IsHidden="True"/>
									</Grid>
								</Grid>
							</Border>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="HeaderTemplate">
				<Setter.Value>
					<DataTemplate>
						<Grid>
							<StackPanel Grid.Column="0" HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
								<TextBlock Foreground="#000" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" LineStackingStrategy="BlockLineHeight" LineHeight="20"  Text="{Binding Title}"/>
								<TextBlock Foreground="{Binding AccentBrush}" FontSize="9" LineStackingStrategy="BlockLineHeight" LineHeight="20" Margin="0,0,3,0" Text="{Binding SubTitle}"/>
							</StackPanel>
							<ContentPresenter ContentTemplate="{x:Null}" Content="{Binding HeaderContent, Converter={StaticResource ComponentArt_DashboardPanel_DetachFromVisualTree}}" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
						</Grid>
					</DataTemplate>
				</Setter.Value>
			</Setter>
		</Style>

	</UserControl.Resources>
	<Grid x:Name="LayoutRoot" Background="White" MouseRightButtonDown="LayoutRoot_MouseRightButtonDown" 
		  MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown">

		<Grid x:Name="GadgetWindow" Background="White" MinWidth="450" >
			<Grid.RowDefinitions>
        		<RowDefinition Height="50"/>
        		<RowDefinition/>
        	</Grid.RowDefinitions>
        	<Grid.ColumnDefinitions>
        		<ColumnDefinition Width="Auto"/>
        		<ColumnDefinition/>
        	</Grid.ColumnDefinitions>
			<Rectangle x:Name="GWindow" Style="{StaticResource GWindow}" Stroke="{StaticResource WindowBrush}" StrokeThickness="4" Grid.RowSpan="2" Grid.ColumnSpan="2" />
			<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="13,11,0,0" d:LayoutOverrides="VerticalAlignment, GridBox">
				<TextBlock x:Name="tbChartName" TextWrapping="Wrap" Text="Epi Curve" VerticalAlignment="Top" Margin="0,0,26,0" Height="Auto" HorizontalAlignment="Left" Foreground="#FF2B4360" FontSize="21.333"/>

				<Rectangle x:Name="GHeader" VerticalAlignment="Top" Height="4" Margin="0,2,0,0" StrokeThickness="0" Fill="#FF00B050" />
               
            </StackPanel>
			<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Top" Margin="180,9,10,0" Grid.Column="1">
				<Button x:Name="FilterButton" Content="" Template="{StaticResource FilterButton}" Cursor="Hand" Click="FilterButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="HeaderButton" Content="" Template="{StaticResource HeaderButton}" Cursor="Hand" Click="HeaderButton_Click"  Width="24" Height="24" IsEnabled="False">
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="ResizeButton" Content="" Template="{StaticResource resizebtn}" Cursor="Hand" Click="ResizeButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="CloseButton" Content="" Template="{StaticResource CloseButton}" Cursor="Hand" Click="CloseButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
			</StackPanel>
			<Grid x:Name="GadgetContentGrid" Grid.Row="1" Margin="0,5,0,0" MinHeight="30" Grid.ColumnSpan="2">
				<toolkit:Expander Margin="0,-45,131,0" VerticalAlignment="Top" 
					ExpandDirection="Down" IsExpanded="True" Style="{StaticResource ExpanderStyle2}" Canvas.ZIndex="999" HorizontalAlignment="Right" Width="188" x:Name="gadgetExpander">

					<toolkit:Expander.Header>
						<TextBlock Text="Edit Properties" FontFamily="Segoe UI" Cursor="Hand" FontSize="13.333" FontWeight="Normal" Foreground="White"/>
					</toolkit:Expander.Header>
					<Grid Background="#FF5C53AC" Margin="0,-2,1,10" Width="178" HorizontalAlignment="Right">
						<StackPanel Margin="4,4,4,10" VerticalAlignment="Top" HorizontalAlignment="Center" Width="164">
							<!--<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Chart Type:" Margin="0,5,0,0"  />
							<ComboBox x:Name="cbxChartType" HorizontalAlignment="Left" Width="140"  SelectedIndex="0" >
								<ComboBoxItem Content="Epi Curve" />
								<ComboBoxItem Content="Scatter" />
								<ComboBoxItem Content="Stacked Column" />
								<ComboBoxItem Content="Bar" />
								<ComboBoxItem Content="Column" />
								<ComboBoxItem Content="Line" />
								<ComboBoxItem Content="Pie" />
								<ComboBoxItem Content="Pareto" />
							</ComboBox>-->
							<StackPanel x:Name="pnlEpiCurveConfig">
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Onset Date Field:" Margin="0,5,0,0" Foreground="White"  />
								<ComboBox x:Name="cbxDateField" HorizontalAlignment="Left" Width="164" SelectedIndex="0" />
								<TextBlock HorizontalAlignment="Left" TextAlignment="Center" Text="Case Status Field:" Margin="0,5,0,0" Foreground="White"  />
								<ComboBox x:Name="cbxCaseStatusField" HorizontalAlignment="Left" Width="164" SelectedIndex="0" />
                                <TextBlock x:Name="tblockSteps" HorizontalAlignment="Left" TextAlignment="Center" Text="Steps:" Margin="0,5,0,0" Foreground="White" Visibility="Collapsed" />

								<TextBlock x:Name="tblockDateInterval" HorizontalAlignment="Left" TextAlignment="Center" Text="Date Interval:" Margin="0,7,0,0" Foreground="White" VerticalAlignment="Top"  />
								<TextBox x:Name="tbSteps" HorizontalAlignment="Left" TextWrapping="Wrap" Text="1" Width="38" VerticalAlignment="Top" Height="30" Visibility="Collapsed"/>
								<ComboBox x:Name="cbxDateInterval" HorizontalAlignment="Left" Width="164" SelectedIndex="0" VerticalAlignment="Top" Margin="0,1,0,0" >
									<ComboBoxItem Content="Days"/>
									<ComboBoxItem Content="Hours"/>
									<ComboBoxItem Content="Months"/>
									<ComboBoxItem Content="Years"/>
								</ComboBox>

								<TextBlock x:Name="textXAxisStartValue" HorizontalAlignment="Left" TextAlignment="Center" Text="x-axis start value:" Margin="0,5,0,0" Foreground="White"  />
								<sdk:DatePicker Grid.Row="1" Height="23" HorizontalAlignment="Left" x:Name="datePicker1" VerticalAlignment="Center" Width="120" SelectedDateChanged="datePicker1_SelectedDateChanged" Style="{StaticResource DatePickerStyle1}" />
								<!--<TextBox x:Name="txtXAxisStartValue" Margin="0,5,0,0" />-->
								<TextBlock x:Name="textXAxisEndValue" HorizontalAlignment="Left" TextAlignment="Center" Text="x-axis end value:" Margin="0,5,0,0" Foreground="White"  />
								<sdk:DatePicker Grid.Row="1" Height="23" HorizontalAlignment="Left" x:Name="datePicker2" VerticalAlignment="Top" Width="120" SelectedDateChanged="datePicker1_SelectedDateChanged" Style="{StaticResource DatePickerStyle1}" />                                
								<!--<TextBox x:Name="txtXAxisEndValue" Margin="0,5,0,0"  />-->
							</StackPanel>
							<Button x:Name="btnRun" Margin="0,15,0,0" Click="btnRun_Click" Content="Run Gadget" Style="{StaticResource btnSec}" HorizontalAlignment="Center" Width="105" Height="28"/>
						</StackPanel>

					</Grid>
				</toolkit:Expander>

				<StackPanel x:Name="spContent" Orientation="Vertical" Margin="10" Visibility="Collapsed">
					<StackPanel x:Name="pnlStatus" Height="58" MaxHeight="40" Width="Auto" Background="#FFf8d7e2" VerticalAlignment="Top" Margin="0,5" Visibility="Collapsed">
						<StackPanel x:Name="pnlStatusTop" Height="2" Width="Auto" Background="#FFe4658e"/>
						<Image x:Name="ErrorIcon" Source="../../Images/error.png" Width="18" Height="18" HorizontalAlignment="Left" Margin="5,1,5,0" VerticalAlignment="Center"/>
						<TextBlock x:Name="txtStatus" Text="Error: Exception occurred." TextWrapping="Wrap" Margin="30,-15,5,5" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center"/>
					</StackPanel>
					<StackPanel x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top">
						<TextBlock x:Name="tbGadgetDescription" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="3,3,0,6" Visibility="Visible" MaxWidth="650" Padding="0,0,10,0" />
						<Grid x:Name="grdTitle" HorizontalAlignment="Center"  VerticalAlignment="Top" Margin="0,10,0,0"><TextBlock x:Name="txtChartTitle" Text="" TextWrapping="Wrap" HorizontalAlignment="Center" FontWeight="Bold" VerticalAlignment="Top"/></Grid>
						<Grid x:Name="grdChart" HorizontalAlignment="Left"  VerticalAlignment="Top" Margin="0,20,0,0">
							
							<StackPanel x:Name="pnlChartContainer" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Top"/>
						</Grid>
						<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
							<TextBlock Text="N = " HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" Height="18" Margin="0,0,0,15"/>
							<TextBlock x:Name="tbNumberOfRecords" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible"  d:LayoutOverrides="VerticalAlignment" Height="18" Margin="0,0,0,15"  />
						</StackPanel>
					</StackPanel>
		
				</StackPanel>
				<Grid x:Name="waitCursor" Background="#36C4C4C4" Height="Auto" Visibility="Collapsed">
					<toolkit:BusyIndicator x:Name="BusyIndicator" IsBusy="True" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="100" />
				</Grid>
			</Grid>
		</Grid>
		<!--</groupBox:GroupBox>-->
		<!--<Image x:Name="imgClose" Source="Images\x.png" HorizontalAlignment="Right" VerticalAlignment="Top"/>-->
	</Grid>
</UserControl>
